﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HR.ProjectX.Models.Entities.Customers;
using HR.ProjectX.Models.Entities.Vehicles;

namespace HR.ProjectX.Models.Entities.Bookings
{
    public class Booking : EntityBase<int>, IAggregateRoot
    {
        public virtual BookingStatus BookingStatus { get; set; }
        public virtual Customer Customer { get; set; }
        public virtual Vehicle Vehicle { get; set; }
        public virtual DateTime DateFrom { get; set; }
        public virtual DateTime DateTo { get; set; }

        protected override void Validate()
        {
            if (DateFrom == null)
            {
                base.AddBrokenRule(BookingBusinessRules.DateFromRequired);
            }

            if (DateTo == null)
            {
                base.AddBrokenRule(BookingBusinessRules.DateToRequired);
            }
        }
    }
}
